ConstDefault Trait
A Default
-like trait and derive macros for const
evaluation contexts.
This crate defines the ConstDefault
trait and implements it for
Rust primitives, prelude types, tuples and arrays. Furthermore it
provides a derive macro so that users can implement ConstDefault
easily for their custom types.
- 100% safe Rust
no_std
compatible- Full macro hygiene
- No dependencies
Usage
Add
[]
= { = "1.0", = ["derive"] }
to your Cargo.toml
to start using it.
Examples
Rust Primitives
use ConstDefault;
Derive
use ConstDefault;